<?php 
	Class Guild extends CI_Controller{
		public function __construct(){
			parent::__construct();
			$this->load->model('model_guild');
			$this->load->model('model_guildbanner');
			$this->load->model('model_restaurant');	
			$this->load->model('model_activity');	
			$this->load->model('model_package');	
			$this->load->model('model_flight');	
			$this->load->model('model_car');	
		}	
		public function search(){
			$data['data']=array();
			if(isset($_GET["provide"]) && isset($_GET["language"])){
				$data['data']=$this->model_guild->listdataByprovide_languaga($_GET['provide'],$_GET['language'],10,0);
				$data['total']=$this->model_guild->listdataByprovide_languaga($_GET['provide'],$_GET['language'],1000000000,0);
			}
			foreach($data['data'] as $list){
				$data['listbanner'][]=$this->model_guildbanner->gettopbanner_search($list['id']);
			}
			$data['listname_restaurant']=$this->model_restaurant->listall_name();
						
			$data['template']='guild/guild_search';
			$this->load->view('layout',$data);
		}
		public function detail($idguild){
			$data['idguild']=intval($idguild);
			if(isset($idguild)){
				$data['data']=$this->model_guild->getdata(intval($idguild));
				$data['banner']=$this->model_guildbanner->getallbyguildid(intval($idguild));
				$data['guild_package']=$this->model_guild->getpackagebyguildid(intval($idguild));
			}
			$data["restaurant"]=$this->model_restaurant->gettopByprovide_status($data['data']['provide'],0,6,0);
			$data["activities"]=$this->model_activity->gettopByprovide_status($data['data']['provide'],0,6,0);
			$data["package"]=$this->model_package->gettopByprovide_status($data['data']['provide'],0,6,0);
			$data["flight"]=$this->model_flight->gettopByprovide_status($data['data']['provide'],0,6,0);
			$data["car"]=$this->model_car->gettopByprovide_status($data['data']['provide'],0,3,0);
			$data["guide"]=$this->model_guild->gettopByprovide_status($data['data']['provide'],0,3,0);
			$data['listname_restaurant']=$this->model_restaurant->listall_name();
			
			$data['template']='guild/guild_detail';
			$this->load->view('layout',$data);
		}
	}
?>